<script lang="ts" setup>
import { onBeforeMount, ref } from 'vue';
import * as service from '@/service/api/organization';
import { isSuccess } from '@/utils/response';

const options = ref([]);

onBeforeMount(async () => {
  const response = await service.tree({ include: true });
  if (isSuccess(response)) {
    options.value = response.data;
  }
});
</script>

<template>
  <n-cascader label-field="name" value-field="id" :options="options" />
</template>
